package com.luguokong.pet_rescue.service;

import com.luguokong.pet_rescue.mapper.PetFoodMapper;
import com.luguokong.pet_rescue.pojo.PetFood;
import com.luguokong.pet_rescue.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PetFoodService {

    @Autowired
    private PetFoodMapper petFoodMapper;

    public int insertPetFood(PetFood petFood){
        int i = petFoodMapper.insertPetFood(petFood);
        return i;
    }
    public int deletePetFoodById(int food_id){
        int i = petFoodMapper.deletePetFoodById(food_id);
        return i;
    }
    public int updatePetFoodById(PetFood petFood){
        int i = petFoodMapper.updatePetFoodById(petFood);
        return i;
    }
    public PetFood selectPetFoodById(int food_id){
        PetFood petFood = petFoodMapper.selectPetFoodById(food_id);
        return petFood;
    }
    public List<PetFood> selectPetFoodAll(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAll();
        return petFoodList;
    }
//    查看所有宠物粮食根据过期日期
    public List<PetFood> selectPetFoodAllByExpDate(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByExpDate();
        return petFoodList;
    }
//    未过期
    public List<PetFood> selectPetFoodAllByUnExpDate(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByUnExpDate();
        return petFoodList;
    }
//    查看所有宠物粮根据宠物类型
    public List<PetFood> selectPetFoodAllByPetType(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByPetType();
        return petFoodList;
    }
//    查看所有宠物粮根据价格升序排列
    public List<PetFood> selectPetFoodAllByPriceByDesc(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByPriceByDesc();
        return petFoodList;
    }
//    查看所有宠物粮根据价格降序排列
    public List<PetFood> selectPetFoodAllByPriceByAsc(){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByPriceByAsc();
        return petFoodList;
    }

    public List<PetFood> selectPetFoodAllByPageNumByPageSize(int pageNum, int pageSize){
        List<PetFood> petFoodList = petFoodMapper.selectPetFoodAllByPageNumByPageSize(pageNum, pageSize);
        return petFoodList;
    }

    public int selectDataCount(){
        int i = petFoodMapper.selectDataCount();
        return i;
    }
}
